package com.fyl.factory;

import com.fyl.dao.UserDao;
import com.fyl.dao.impl.UserDaoImpl;
import org.springframework.beans.factory.FactoryBean;

public class MyBeanFactory3 implements FactoryBean<UserDao> {
    public MyBeanFactory3(String name) {
        System.out.println("name = " + name);
        System.out.println("MyBeanFactory3的构造函数");
    }

    public UserDao userDao (String name) {
        System.out.println("name = " + name);
        //Bean创建之前可以进行一些其他业务逻辑操作
        return new UserDaoImpl();
    }

    @Override
    public UserDao getObject() throws Exception {
        System.out.println("getObject()被调用");
        return new UserDaoImpl();
    }

    @Override
    public Class<?> getObjectType() {
        return UserDao.class;
    }
}
